package cn.kgc.springboot.day05.controller;

import cn.kgc.springboot.day05.entity.User;
import cn.kgc.springboot.day05.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 课工场
 * @date 2024/3/22
 * @description
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("list")
    public List<User>  getList(){
        return userService.list();
    }


    @GetMapping("delete/{id}")
    public Boolean  delete(@PathVariable("id") Integer id){
        return userService.removeById(id);
    }
}
